<!--
 * @Author: underMoonzs 1994186472@qq.com
 * @Date: 2025-10-05 21:41:58
 * @LastEditors: underMoonzs 1994186472@qq.com
 * @LastEditTime: 2025-10-07 15:20:15
 * @FilePath: \environment-map-app\src\App.vue
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
-->
<template>
  <div class="app-container">
    <MainMap />
  </div>
</template>

<script setup>
import { onMounted, onUnmounted } from 'vue'
import MainMap from './components/MainMap.vue'

// 获取URL中的tk参数
const getUrlParams = () => {
  const urlParams = new URLSearchParams(window.location.search);
  const tk = urlParams.get('tk');
  if (tk) {
    // 设置到环境变量或全局配置中
    import.meta.env.VITE_APP_TIANDITU_TOKEN = tk;
  }
}

// 组件卸载时清理事件监听
const cleanup = () => {
  // 清理事件监听器
}

onMounted(() => {
  getUrlParams()
})

// 在组件卸载时执行清理
onUnmounted(() => {
  cleanup()
})
</script>

<style>
/* 全局样式可以放在这里 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  overflow: hidden;
}

.app-container {
  width: 100%;
  height: 100vh;
  position: relative;
  overflow: hidden;
}

/* 移动端适配 */
@media screen and (max-width: 768px) {
  .app-container {
    height: 100dvh; /* 使用动态视口单位 */
  }
  
  /* 针对iOS安全区域适配 */
  .app-container {
    padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  }
}
</style>